using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows.Forms;
using Microsoft.VisualStudio.DebuggerVisualizers;
using Microsoft.Xna.Framework.Graphics;
[assembly:DebuggerVisualizer(typeof(Xfinity.Debugging.Visualizers.ColorVisualizer),
                             typeof(VisualizerObjectSource),
                             Target=typeof(Microsoft.Xna.Framework.Graphics.Color))]
namespace Xfinity.Debugging.Visualizers
{
    /// <summary>
    /// A Visualizer for SomeType.  
    /// </summary>
    public class ColorVisualizer : DialogDebuggerVisualizer
    {
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            // TODO: Get the object to display a visualizer for.
            //       Cast the result of objectProvider.GetObject() 
            //       to the type of the object being visualized.
            Color data = (Color)objectProvider.GetObject();

            // TODO: Display your view of the object.
            //       Replace displayForm with your own custom Form or Control.
            using (Form displayForm = new Form())
            {
                displayForm.BackColor=System.Drawing.Color.FromArgb(data.A,data.R,data.G,data.B);
                windowService.ShowDialog(displayForm);
            }
        }

        // TODO: Add the following to your testing code to test the visualizer:
        // 
        //    ColorVisualizer.TestShowVisualizer(new SomeType());
        // 
        /// <summary>
        /// Tests the visualizer by hosting it outside of the debugger.
        /// </summary>
        /// <param name="objectToVisualize">The object to display in the visualizer.</param>
        public static void TestShowVisualizer(object objectToVisualize)
        {
            VisualizerDevelopmentHost visualizerHost = new VisualizerDevelopmentHost(objectToVisualize, typeof(ColorVisualizer));
            visualizerHost.ShowVisualizer();
        }
    }
}